{literal}
<style type="text/css">
.captcha {margin: 5px 10px; width:210px; float: right; background: #efefef; padding: 3px;}
.captcha_x 
{	width:10px; height: 10px; float: right;	 
	padding: 1px 1px 1px 1px; margin-right: 4px; 
	cursor: pointer; 
	text-align:center; 
	background-color: #ffab12; 
	border-left: solid 1px #FEFEFE; 
	border-top: solid 1px #FEFEFE;  
	border-bottom: solid 1px #DDDDDD; 
	border-right: solid 1px #DDDDDD;	
}
div.captcha_x
{ color: #16487A; text-decoration: none; font-size: 11px; }
div:hover.captcha_x
{ 
	color: #16487A; text-decoration: none; font-size: 11px;
	background: #DEDEDE; border-bottom: solid 1px #999999; border-right: solid 1px #999999;
}

#komunikat { width:100px; font-size: 9px; font:serif; font-weight: bold; text-align: left; vertical-align: middle; color: red; padding-right: 10px;}
</style>
{/literal}

<div class="captcha">	
	<div href="#" class="captcha_x" id="captcha0"> </div>
	<div href="#" class="captcha_x" id="captcha1"> </div>
	<div href="#" class="captcha_x" id="captcha2"> </div>
	<div href="#" class="captcha_x" id="captcha3"> </div>
	<div href="#" class="captcha_x" id="captcha4"> </div>	
	<div id="komunikat">{$__cl.kliknij_w_wybrany_kolor}</div>
</div>

{literal}
<script type="text/javascript">
	$(document).ready(function(){
		var green = Math.floor(Math.random()*4);
		$("#captcha"+green).css("background-color","#ff0000");

		$(".captcha_x").click( function() {
			if(rgb2hex($(this).css("background-color"))== "#ff0000" ) $(this).css("background-color","#008000") ;
			else if (rgb2hex($(this).css("background-color")) == "#ff0000") $(this).css("background-color","#ff0000") ;
			else 	$("#captcha"+green).css("background-color","#ff0000");
		});

		$("#{/literal}{$formID}{literal}").submit(function() {
			return__ = true;				
			if (rgb2hex($("#captcha"+green).css("background-color")) == "#008000") {				
			}else{
				alert("Proszę kliknąć w czerwone pole!");
				return__ = false ;
			}
		return return__;
		});
	});

	//Function to convert hex format to a rgb color  
	function rgb2hex(rgb) {  
		if(rgb.match("#")) return rgb;
		rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
		function hex(x) {  
			hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");  
			return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];  
		}		
		return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);  
	}  
 
</script>
{/literal}